﻿@inherits ListOperateTableBase<SysJobTriggerDto, int, JobTriggerEdit, EasyJobLocalResource>
@page "/system_manager/easy_job_trigger"
<div>
    <Table @ref="_table"
           TItem="SysJobTriggerDto"
           DataSource="@_datas"
           Total="_total"
           OnChange="@OnChange"
    @bind-PageSize="_pageSize"
           @bind-PageIndex="_pageIndex"
    @bind-SelectedRows="_selectedRows"
           Loading="@_tableLoading.Value"
           Context="model"
           ScrollX="100%"
           PaginationPosition="@ClientConstant.TablePaginationPosition"
    RemoteDataSource>
        <TitleTemplate>
            <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_search">
                <TableSearch TDto="SysJobTriggerDto" @ref="this._tableSearch" OnSearch="OnTableSearch" Settings="@_tableSearchSettings" CustomLocalizer="Localizer" />
            </ResourceAuthorize>
            <Row>
                <AntDesign.Col Span="8">
                    @* <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_delete_selected">
                    <Button Type="@ButtonType.Primary" Icon="delete" Danger OnClick="OnClickDeletes" Loading="_deletesBtnLoading">
                    @Localizer[nameof(SharedLocalResource.DeleteSelected)]
                    </Button>
                    </ResourceAuthorize> *@
                </AntDesign.Col>
                <AntDesign.Col Span="16" Style="text-align:right">
                    <Space>
                        <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_monitor_state">
                            <SpaceItem>
                                <label>@Localizer[nameof(EasyJobLocalResource.RealTimeMonitor)]</label> <Switch Checked="enableRealTimeMonitor" Loading="enableRealTimeMonitorLoading" CheckedChildren="@Localizer[nameof(SharedLocalResource.Open)]" UnCheckedChildren="@Localizer[nameof(SharedLocalResource.Open)]" OnChange="OnEnableRealTimeMonitorChange" />
                            </SpaceItem>
                        </ResourceAuthorize>
                        <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_add">
                            <SpaceItem>
                                <Button Type="@ButtonType.Primary" Icon="plus" OnClick="OnClickAdd">
                                    @Localizer[nameof(SharedLocalResource.Add)]
                                </Button>
                            </SpaceItem>
                        </ResourceAuthorize>
                        <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_refresh">
                            <SpaceItem>
                                <Button Type="@ButtonType.Primary" Icon="reload" OnClick="ReLoadTable">
                                    @Localizer[nameof(SharedLocalResource.Refresh)]
                                </Button>
                            </SpaceItem>
                        </ResourceAuthorize>
                    </Space>
                </AntDesign.Col>
            </Row>
        </TitleTemplate>
        <ColumnDefinitions>
            @* <Selection Key="@(model.Id.ToString())" Hidden="@_userUnauthorizedResources["system_manager_easy_job_trigger_delete_selected"]" Width="40" Fixed="left" /> *@
            <Column @bind-Field="@model.TriggerId" Filterable Title="@Localizer[nameof(EasyJobLocalResource.TriggerId)]" Width="150" Fixed="left" />
             <Column @bind-Field="@model.JobId" Filterable Title="@Localizer[nameof(EasyJobLocalResource.JobId)]" Width="150" Fixed="left">
                 <a href="system_manager/easy_job_detail?JobId=@model.JobId">@model.JobId</a>
             </Column>
             <Column @bind-Field="@model.Description" Filterable Title="@Localizer[nameof(SharedLocalResource.Description)]" Width="150" Fixed="left" />
             <Column @bind-Field="@model.Status" Filterable Title="@Localizer[nameof(SharedLocalResource.Status)]" Width="150" Fixed="left">
                 <TagPro Text="@model.Status" Localizer="Localizer" />
             </Column>
             <Column @bind-Field="@model.LastRunTime" Format="@ClientConstant.DateTimeFormat" Sortable Title="@Localizer[nameof(SharedLocalResource.LastRunTime)]" Width="200" />
             <Column @bind-Field="@model.NextRunTime" Format="@ClientConstant.DateTimeFormat" Sortable Title="@Localizer[nameof(SharedLocalResource.NextRunTime)]" Width="200" />
             <Column @bind-Field="@model.ElapsedTime" Filterable Title="@Localizer[nameof(EasyJobLocalResource.ElapsedTime)]" Width="150" />
             <Column @bind-Field="@model.NumberOfRuns" Filterable Title="@Localizer[nameof(EasyJobLocalResource.NumberOfRuns)]" Width="150" />
             <Column @bind-Field="@model.NumberOfErrors" Filterable Title="@Localizer[nameof(SharedLocalResource.NumberOfErrors)]" Width="150" />
             <Column @bind-Field="@model.TriggerType" Filterable Title="@Localizer[nameof(EasyJobLocalResource.TriggerAssemblyType)]" Width="150" />
             <Column @bind-Field="@model.AssemblyName" Filterable Title="@Localizer[nameof(EasyJobLocalResource.AssemblyName)]" Width="150" />
             <Column @bind-Field="@model.Args" Filterable Title="@Localizer[nameof(EasyJobLocalResource.TriggerArgs)]" Width="150" />
             <Column @bind-Field="@model.StartNow" Filterable Title="@Localizer[nameof(SharedLocalResource.StartNow)]" Width="150">
                 <TagYesNo Yes="model.StartNow"></TagYesNo>
             </Column>
             <Column @bind-Field="@model.RunOnStart" Filterable Title="@Localizer[nameof(SharedLocalResource.RunOnceOnStart)]" Width="150">
                 <TagYesNo Yes="model.RunOnStart"></TagYesNo>
             </Column>
             <Column @bind-Field="@model.ResetOnlyOnce" Filterable Title="@Localizer[nameof(SharedLocalResource.ResetOnlyOnce)]" Width="150">
                 <TagYesNo Yes="model.ResetOnlyOnce"></TagYesNo>
             </Column>

             <Column @bind-Field="@model.MaxNumberOfRuns" Filterable Title="@Localizer[nameof(SharedLocalResource.MaxNumberOfRuns)]" Width="150" />
             <Column @bind-Field="@model.MaxNumberOfErrors" Filterable Title="@Localizer[nameof(SharedLocalResource.MaxNumberOfErrors)]" Width="150" />
             <Column @bind-Field="@model.NumRetries" Filterable Title="@Localizer[nameof(SharedLocalResource.NumRetries)]" Width="150" />
             <Column @bind-Field="@model.RetryTimeout" Filterable Title="@Localizer[nameof(SharedLocalResource.RetryTimeout)]" Width="150" />
             <Column @bind-Field="@model.StartTime" Format="@ClientConstant.DateTimeFormat" Sortable Title="@Localizer[nameof(SharedLocalResource.StartTime)]" Width="200" />
             <Column @bind-Field="@model.EndTime" Format="@ClientConstant.DateTimeFormat" Sortable Title="@Localizer[nameof(SharedLocalResource.EndTime)]" Width="200" />
             <Column @bind-Field="@model.CreatedTime" Format="@ClientConstant.DateTimeFormat" Sortable DefaultSortOrder="@SortDirection.Descending" Title="@Localizer[nameof(SharedLocalResource.CreatedTime)]" Width="200" />
             <ActionColumn Width="300" Fixed="right">
                 <Space>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_edit">
                         <SpaceItem>
                             <Tooltip Title="@Localizer[nameof(SharedLocalResource.Edit)]" ArrowPointAtCenter="true">
                                 <Button Icon="edit" Type="@ButtonType.Primary" Size="@ClientConstant.OperationButtonSize" OnClick="()=>OnClickEdit(model.Id)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_detail">
                         <SpaceItem>
                             <Tooltip Title="@Localizer[nameof(SharedLocalResource.Detail)]" ArrowPointAtCenter="true">
                                 <Button Icon="eye" Type="@ButtonType.Primary" Size="@ClientConstant.OperationButtonSize" OnClick="()=>OnClickDetail(model.Id)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_start">
                         <SpaceItem>
                             <Tooltip Title="@(EasyJobLocalResource.Start)" ArrowPointAtCenter="true">
                                 <Button Color="@Color.Green6" Icon="caret-right" Type="@ButtonType.Primary" Size="@ClientConstant.OperationButtonSize" OnClick="()=>OnClickStart(model.Id)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_pause">
                         <SpaceItem>
                             <Tooltip Title="@(EasyJobLocalResource.Pause)" ArrowPointAtCenter="true">
                                 <Button Color="Color.Red5" Icon="pause" Type="@ButtonType.Primary" Size="@ClientConstant.OperationButtonSize" OnClick="()=>OnClickPause(model.Id)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_log">
                         <SpaceItem>
                             <Tooltip Title="@(EasyJobLocalResource.Log)" ArrowPointAtCenter="true">
                                 <Button Icon="profile" Type="@ButtonType.Primary" Size="@ClientConstant.OperationButtonSize" OnClick="()=>OpenJobLogConsole(model)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                     <ResourceAuthorize ResourceKey="system_manager_easy_job_trigger_delete">
                         <SpaceItem>
                             <Tooltip Title="@Localizer[nameof(SharedLocalResource.Delete)]" ArrowPointAtCenter="true">
                                 <Button Icon="delete" Type="@ButtonType.Primary" Danger OnClick="()=>OnClickTrueDelete(model.Id)"></Button>
                             </Tooltip>
                         </SpaceItem>
                     </ResourceAuthorize>
                 </Space>
             </ActionColumn>
         </ColumnDefinitions>
     </Table>
 </div>